feat(loyalty): add loyalty to purchase requests and a loyalty read API - #34
Merged
Merged
Conversation
dinosoeren
force-pushed
the
feat/loyalty-purchase-field-and-read-api
branch
from
July 27, 2026 19:28
e848b16 to
9289a98
Compare
dinosoeren
force-pushed
the
feat/loyalty-purchase-field-and-read-api
branch
5 times, most recently
from
July 28, 2026 04:55
a0f0454 to
f3bf598
Compare
dinosoeren
force-pushed
the
feat/loyalty-purchase-field-and-read-api
branch
6 times, most recently
from
July 28, 2026 07:44
4549cef to
35efe77
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 35efe77. Configure here.
dinosoeren
force-pushed
the
feat/loyalty-purchase-field-and-read-api
branch
2 times, most recently
from
July 28, 2026 08:10
cf0c56d to
a6277ef
Compare
Loyalty standing snapshot (PlayerLoyaltyState) on egress purchase requests and the loyalty read API. The egress and ingress loyalty messages are fully self-contained per API: each PlayerLoyaltyState nests its own Milestone and MilestoneRewardItem, and the ingress config LoyaltyMilestone nests its own MilestoneRewardItem, so ingress and egress share no loyalty types. Milestone rewards are lists; the snapshot's next_milestone carries the milestone id plus all rewards. Numeric fields use uint32 (xp_delta int32); tier ids and xp_to_next fields carry optional presence. The points multiplier is a fixed-point permille integer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dinosoeren
force-pushed
the
feat/loyalty-purchase-field-and-read-api
branch
from
July 28, 2026 08:36
a6277ef to
9b78509
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Two additive, backward-compatible changes to the public API.
Loyalty on purchase requests (egress). Adds an optional
loyaltysub-payload to theRegisterPaymentandConfirmPaymentrequests. It describes the player's standing in a shop's active loyalty program at purchase time — points balance, current and previous tier, distance to the next tier and milestone, the next milestone's reward, and an effective points multiplier (the current tier's points-per-dollar rate relative to the tier below it,1.0at the lowest tier). The field is present only for shops with an active loyalty campaign, so requests for all other shops are byte-identical to before.Loyalty read API (ingress). Adds a new read-only
Loyaltyservice, authenticated with HMAC over the/sdk/studio/{shop_id}surface, with two endpoints:GET /sdk/studio/{shop_id}/loyalty— the shop's active campaign configuration: tiers (ordered by starting points) and milestones (ordered by points needed).GET /sdk/studio/{shop_id}/loyalty/players/{player_id}— a single player's loyalty standing.Both the purchase field and the player endpoint reuse one shared
Loyaltymessage. The loyalty read API is included in the primary hosted Web Shop API spec.Notes
buf breakingpasses againstmain.docs/gen/swagger.v1.jsonviamake check.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Additive proto and OpenAPI only, but it extends purchase callback contracts and documents new partner-facing loyalty endpoints that implementations must honor consistently.
Overview
Adds loyalty to the public API in two additive ways: partner backends can receive loyalty context on purchase webhooks, and can query loyalty configuration and player standing over the existing HMAC
/sdk/studioingress surface.Purchase egress (Register/Confirm Payment) gains an optional
loyaltyfield (PlayerLoyaltyState) with campaign id, points balance and delta, tier ids, progress to next tier/milestone, next milestone rewards, andpointsMultiplierPermille. It is omitted when the shop has no active campaign so non-loyalty payloads stay unchanged.New ingress
LoyaltyServiceexposesGET /sdk/studio/{shopId}/loyalty(active campaign tiers and nested milestones/rewards) andGET /sdk/studio/{shopId}/loyalty/players/{playerId}(player standing). OpenAPI is merged into the ingress spec (renamed Stash Studio Read API to cover catalog + loyalty) with regenerateddocs/genswagger.Reviewed by Cursor Bugbot for commit 9b78509. Bugbot is set up for automated code reviews on this repo. Configure here.